var _Event = require('component/event.js');

function UserInfo() {
    this.mName = '';
    this.mEvent = new _Event();
}
UserInfo.prototype.cancelName = function () {
    this.fire('namecanceled');
};
UserInfo.prototype.setName = function (name) {
    this.fire('nameavaiable', this.mName = name);
};
UserInfo.prototype.on = function (name, fn, bind) {
    this.mEvent.on(name, fn, bind);
};
/**
 * @param name
 * @param [fn]
 */
UserInfo.prototype.off = function (name, fn) {
    this.mEvent.off.apply(this.mEvent, arguments);
};
/**
 * @param name
 * @param [target]
 */
UserInfo.prototype.fire = function (name, target) {
    this.mEvent.fire.apply(this.mEvent, arguments);
};

module.exports = new UserInfo();
